<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>

<?php 
	$ci = &get_instance();
	$USER = $ci->user_entity->init('id',$ESCORT->getUserId());
?>

<?php if($ESCORT->getReceiveMessage()):?>
	<div class="escort-infor-item-wrapper" id="contact-tab-wrap">
		<span><?php echo language_translate('contact_zone_message_to_escort');?></span>
		<div class="clear"></div> 
	<form action="<?php echo site_url('home/submit_visitor_send_message');?>" name="submit_visitor_send_message" id="submit_visitor_send_message" method="post" enctype="multipart/form-data" >	
		<div class="escort-infor-item-left">
			<label><?php echo language_translate('contact_zone_your_name');?></label>
		</div>
		<div class="escort-infor-item-right">
			<input type="text" maxlength="45" id="visitor_name" name="visitor_name" />
		</div>
			
		<div class="clear"></div>
		<div class="escort-infor-item-left">
			<label><?php echo language_translate('contact_zone_your_email');?></label>
		</div>
		<div class="escort-infor-item-right">	
			<input type="text" maxlength="45" id="visitor_email" name="visitor_email" />
		</div>
			
		<div class="clear"></div>
		<div class="escort-infor-item-left">
			<label><?php echo language_translate('contact_zone_your_mobile_phone');?></label>
		</div>
		<div class="escort-infor-item-right">	
			<input type="text" maxlength="25" id="visitor_phone" name="visitor_phone" />
		</div>
		
		<div class="clear"></div>
		<div class="escort-infor-item-left">
			<label><?php echo language_translate('contact_zone_your_message');?></label>
		</div>
		<div class="escort-infor-item-right">		
			<span>
				<textarea style="width:270px;height:100px;margin-top:0px;" id="message_to_escort" class="message_to_escort" name="message_to_escort"></textarea>
			</span>
		</div>
		
		<div class="clear"></div>
		<div class="escort-infor-item-left">
			<label><?php echo language_translate('contact_zone_enter_captcha');?></label>
		</div>
		<div class="escort-infor-item-right">		
			<div id="captcha-section">
				<?php echo newCaptcha();?> 
			</div>	
			<div id="captcha-reload"></div>
			<div class="clear"></div>
			<input type="text" maxlength="25" id="captcha" name="captcha" style="margin-bottom:10px;margin-top:5px;"/>
		</div>
		<input type="hidden" value="<?php echo $ESCORT->getId();?>" name="escort_id" />
		
		<div class="clear"></div>
		<div class="escort-infor-item-left">&nbsp;</div>
		<div class="escort-infor-item-right">
			<div class="select-box">
				<input type="submit" class="save-button" value="<?php echo language_translate('contact_zone_send_label');?>" /> 
				<?php echo loader_image("id='contact_zone_loader_image' class='hidden'");?>
			</div>
		</div>
		
		<div id="error-message" style="color:red;"></div>
		<div>
			<div id="update-message" style="margin-top:10px;"><?php echo language_translate('contact_zone_successfully_message');?></div>
			<div class="clear"></div>
		</div>
	 
	</form>	
		<div class="clear"></div>
	</div>
<?php endif; ?>



<script type="text/javascript">
	$(document).ready(function() {	
		var options = { 
			beforeSubmit:  validateB4SubmitContact,  
			success:       processAfterRespondingContact  
		};	
		$('#submit_visitor_send_message').ajaxForm(options); 
	  
	});	
 
	function validateB4SubmitContact(formData, jqForm, options){
		$('#contact_zone_loader_image').show();
		$('#error-message').html('');
		$('#contact-info').height('auto');
		return true;
	}
	
	function processAfterRespondingContact(responseText, statusText, xhr, $form) {
		$('#contact_zone_loader_image').hide();	
		if(responseText == 'ok'){
			updatedShow();
		}else{
			$('#error-message').html(responseText).show();
			$('#contact-info').height('auto');
		}
	}
	
</script>






